<?php
/**
 * Zend Framework Contribution
 *
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://framework.zend.com/license/new-bsd
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@zend.com so we can send you a copy immediately.
 *
 * @category   Zend
 * @package    Zend_Mwb
 * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 * @version    1.0 Tables.php 3 mai 2012 Sergio DE VASCONCELOS
 */

require_once('Zend/Mwb/Dom/Abstract.php');
require_once('Zend/Mwb/Dom/Table.php');

/**
 * MySQL Workbench document
 *
 * @category   Zend
 * @package    Zend_Mwb
 */
class Zend_Mwb_Dom_Tables extends Zend_Mwb_Dom_Abstract implements Iterator, Countable
{
	protected $tables = array();
	protected $key = 0;
	protected $count = 0;
	
	public function parse() {
		$dom = $this->node;// DOMNodeList
		$this->tables = array();

        foreach($dom as $child) {
        	if ($child->nodeName=='value') {
        		$this->tables[] = new Zend_Mwb_Dom_Table($child, $this);
	            $this->count++;
        	}
        }
	}
	
	/**
	 * return DOMNode
	 */
	public function create() {
		
	}
	
	/**
	 * return Zend_Mwb_Dom_Schemata
	 */
	public function current () {return $this->tables[$this->key]; }
	public function next () {$this->key++;}
	public function key () {return $this->key;}
	public function valid () { return isset($this->tables[$this->key]); }
	public function rewind () {$this->key = 0;}
	public function count () {return $this->count;}
}
